/**
 * The Session class stores the session string value called token
 * and also the language and locale properties and the "terms and
 * conditions"(tnc) values (a string and the accepted-flag) and
 * finally the number of already redeemed coupon codes is stored.
 * The class provides all accessor methods to set and get the values.
 */
class net.spreadshirt.shop.lib.Session {

	private var _token:String;	private var _lang:String;	private var _locale:String;

	private var _tnc_isAccepted:Boolean;
	private var _tnc_strHTML:String;
	private var _couponsRedeemed:Number;

	/**
	 * Session Constructor
	 */
	public function Session() {
		clear();
	}

	/**
	 * Clears all values.
	 */
	public function clear():Void {
		_token = null;		_lang = null;		_locale = null;
		_tnc_isAccepted = false;
		_tnc_strHTML = "";
		_couponsRedeemed = 0;
	}

	/**
	 * Stores the session value.
	 * 
	 * @param	token	The token string.
	 */
	public function setToken(token:String):Void {
		_token = token;
	}

	/**
	 * Returns the session value.
	 * 
	 * @return	The token string.
	 */
	public function getToken():String {
		return(_token);
	}

	/**
	 * Stores the language code.
	 * 
	 * @param	lang	The language code string.
	 */
	public function setLang(lang:String):Void {
		_lang = lang;
	}

	/**
	 * Returns the language code.
	 * 
	 * @return	The language code string.
	 */
	public function getLang():String {
		return(_lang);
	}

	/**
	 * Stores the locale code.
	 * 
	 * @param	locale	The locale code string.
	 */
	public function setLocale(locale:String):Void {
		_locale = locale;
	}

	/**
	 * Returns the locale code.
	 * 
	 * @return	The locale code string. 
	 */
	public function getLocale():String {
		return(_locale);
	}

	/**
	 * Sets tnc flag value to true.
	 * That means the user has accepted the terms and conditions.
	 * 
	 * @param	isAccepted	A boolean value.
	 */
	public function setTNCAccepted(isAccepted:Boolean):Void {
		_tnc_isAccepted = isAccepted;
	}

	/**
	 * Returns the if the user has accepted the terms and conditions.
	 * 
	 * @return	A boolean value.
	 */
	public function getTNCAccepted():Boolean {
		return(_tnc_isAccepted);
	}

	/**
	 * Stores the HTML string of the terms and conditions text information.
	 * 
	 * @param	strHTML	The html formatted string value.
	 */
	public function setTNC(strHTML:String):Void {
		_tnc_strHTML = strHTML;
	}

	/**
	 * Returns the HTML string of the terms and conditions text information.
	 * 
	 * @return	The html formatted string value.
	 */
	public function getTNC():String {
		return(_tnc_strHTML);
	}

	/**
	 * Stores and increases the number of coupons the user has redeemed.
	 */
	public function increaseNumberOfCoupons():Void {
		_couponsRedeemed++;
	}

	/**
	 * Returns the HTML string of the terms and conditions text information.
	 * 
	 * @return	The html formatted string value.
	 */
	public function getCouponCount():Number {
		return(_couponsRedeemed);
	}


}
